package com.baayso.bms2.config.spring;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.context.annotation.FilterType;
import org.springframework.context.annotation.Import;
import org.springframework.stereotype.Controller;
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
import org.springframework.web.bind.annotation.ControllerAdvice;

/**
 * Spring配置。
 * 
 * @author ChenFangjie(2015年9月19日 下午9:26:05)
 * 
 * @since 1.0.0
 * 
 * @version 1.0.0
 * 
 */
@Configuration
@ComponentScan(basePackages = "com.baayso.bms2", excludeFilters = { @ComponentScan.Filter(type = FilterType.ANNOTATION, value = { Controller.class, ControllerAdvice.class }) })
// @EnableAspectJAutoProxy
@EnableAspectJAutoProxy(proxyTargetClass = true)
@Import({ CachingConfig.class, JpaConfig.class })
public class AppConfig {

    /** Bean Validation 1.1（JSR-349） */
    @Bean
    public LocalValidatorFactoryBean validator() {
        return new LocalValidatorFactoryBean();
    }

}
